import bean.ListNode;

public class Main {

    public static void main(String[] args) {
        System.out.println("Hello World!");
//        LeetCode1047.test("aa");
//        LeetCode83.ListNode node1 = new LeetCode83.ListNode(34);
//        LeetCode83.ListNode node2 = new LeetCode83.ListNode(34,node1);
//        LeetCode83.ListNode node3 = new LeetCode83.ListNode(34,node2);
//        LeetCode83.ListNode node4 = new LeetCode83.ListNode(33,node3);
//        LeetCode83.ListNode node5 = new LeetCode83.ListNode(33,node4);
//        LeetCode83.ListNode returnNode = LeetCode83.deleteDuplicates(node5);
//
//        LeetCode83.ListNode node = returnNode;
//        do {
//            System.out.println("node val:" + node.val);
//            node = node.next;
//        }while (node != null);

//        LeetCode704 leetCode704 = new LeetCode704();
//        System.out.println(leetCode704.search2(new int[]{-3, 0,1,2,3},2));

//        LeetCode278 leetCode278 = new LeetCode278();
//        System.out.println(leetCode278.firstBadVersion2(9));

//        LeetCode35 leetCode35 = new LeetCode35();
//        System.out.println(leetCode35.searchInsert(new int[]{1,2 ,3, 4, 6 , 8, 9}, 7));

//        LeetCode977 leetCode977 = new LeetCode977();
//        int[] arr = leetCode977.sortedSquares(new int[]{-3, 0,1,2,3});
//        for (int x: arr){
//            System.out.print(x + " ");
//        }

//        LeetCode189 leetCode189 = new LeetCode189();
//        leetCode189.rotate1(new int[]{1,2 ,3, 4, 6 , 8, 9, -1}, 6);

//        LeetCode283 leetCode283 = new LeetCode283();
//        leetCode283.moveZeroes(new int[]{-3, 0,1,0,2,3});

//        LeetCode344 leetCode344 = new LeetCode344();
//        String s = "hello chijiba";
//
//        leetCode344.reverseString(s.toCharArray());

//        LeetCode557 leetCode557 = new LeetCode557();
//        System.out.println(leetCode557.reverseWords("Let's take LeetCode contest"));

//        LeetCode876 leetCode876 = new LeetCode876();
//        int i = 3;
//        LeetCode876.ListNode head = new LeetCode876.ListNode(1);
//        LeetCode876.ListNode next = new LeetCode876.ListNode(2);
//        head.next = next;
//        while (i < 7){
//            LeetCode876.ListNode listNodeN = new LeetCode876.ListNode(i);
//            next.next = listNodeN;
//            next = next.next;
//            i++;
//        }
//
////        while (head != null){
////            System.out.print(head.val + " ");
////            head = head.next;
////        }
//        LeetCode876.ListNode listNode = leetCode876.middleNode(head);
//        while (listNode != null){
//            System.out.print(listNode.val + " ");
//            listNode = listNode.next;
//        }

//        leetcode3();

//        leetcode567();

        leetcode19();

    }

    public static void leetcode567(){
        LeetCode567 leetCode567 = new LeetCode567();
        System.out.println(leetCode567.checkInclusion2("ab", "eidbbooo"));
    }

    public static void leetcode3(){
        LeetCode3 leetCode3 = new LeetCode3();
        System.out.println(leetCode3.lengthOfLongestSubstring("pwwkeq"));;
    }

    public static void  leetcode19(){
        int i = 3;
        ListNode head = new ListNode(1);
        ListNode next = new ListNode(2);
        head.next = next;
        while (i < 8){
            ListNode listNodeN = new ListNode(i);
            next.next = listNodeN;
            next = next.next;
            i++;
        }

        LeetCode19 leetCode19 = new LeetCode19();


//        while (head != null){
//            System.out.print(head.val + " ");
//            head = head.next;
//        }

        ListNode listNode = leetCode19.removeNthFromEnd2(head, 1);
        while (listNode != null){
            System.out.print(listNode.val + " ");
            listNode = listNode.next;
        }
    }
}
